package com.okami.designpatterns.single;

/**
 * @description: 双重检查
 * @author: TanJingyu
 * @create: 2020-12-15 10:57
 **/
public class SingletonDoubleCheck {
    private volatile static SingletonDoubleCheck instance;

    static SingletonDoubleCheck getInstance() {
        if (instance == null) {
            synchronized (SingletonDoubleCheck.class) {
                if (instance == null) {
                    instance = new SingletonDoubleCheck();
                }
            }
        }
        return instance;
    }
}
